package cn.tedu;

import java.sql.Connection;
import java.sql.Statement;
import java.util.Scanner;

import static cn.tedu.DBUtils.getConn;

public class Demo06 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入英雄名:");
        String name = scanner.nextLine();
        System.out.println("请输入价格:");
        int money = scanner.nextInt();

        try ( Connection conn = getConn()){

            Statement s = conn.createStatement();
            s.execute("insert into hero values (null , '" + name + "'," + money +")");
        }catch (Exception e) {
            e.printStackTrace();
        }

    }
}
